//实现readyonly和deprecate两个装饰器
export { }
let readonly = (target:any,key:any) => {
  Object.defineProperty(target, key, {
    writable:false
  })
}
let deprecate = (target: any, methodName: any, descriptor: any){
  //先缓存老方法
  let oldMethod = descriptor.value;
  descriptor.value = function (...args) {
    let message = (
      `DEPRECATION${target.constructor.name}#${methodName}:this function will be removed in future version!!!`
    );
    console.warn(message);
    return oldMethod(...args)
  }
}
class Circle {
  // @readonly
  pi:number=3.14;
  @deprecate
  getName() {
    console.log('getName')
  }
};
let circle = new Circle();
// circle.pi = 4444;
// console.log(circle);
circle.getName();